package com.scs.application.modules.finance.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.scs.application.core.mapper.IBaseMapper;
import com.scs.application.modules.finance.dto.BillItemHrp;
import com.scs.application.modules.finance.entity.BillItem;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 */
public interface BillItemMapper extends IBaseMapper<BillItem> {


    /**
     * 重新计算结算单价格
     * @param settlementId
     */
    void calculateSettlementPrice(@Param("settlementId") String settlementId);


    List<BillItemHrp> billItemList( @Param("flagOmoc") String flagOmoc);


    List<BillItem> getbillItemList(@Param(Constants.WRAPPER) QueryWrapper<BillItem> wrapper, @Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("flagOmoc") String flagOmoc);


    void updateBillItemInvoice(@Param(Constants.WRAPPER) QueryWrapper<BillItem> wrapper, @Param("flagOmoc") String flagOmoc, @Param("settlementId") String settlementId, @Param("status") Integer status);



    void saveHrpKeyHigh(@Param("hrpKey") String hryKey,@Param("hrpId") String hrpId,@Param("busDate") String busDate,
                    @Param("rfid") String rfid, @Param("inpatientNo") String inpatientNo,
                    @Param("skuQty") Double skuQty,@Param("hrpCode") String hrpCode);


    void saveHrpKeyLow(@Param("hrpKey") String hrpKey,@Param("hrpId") String hrpId,
                       @Param("sn") String sn, @Param("skuQty") String skuQty, @Param("hrpCode") String hrpCode);
    float getHrpQty(@Param("hrpId") String hrpId,@Param("busDate") String busDate);

	//根据主单据id查询明细
    List<BillItem> findBillById(@Param("list") List<String> id);

    //修改明细中对应的hrp单据
    void updateBillItem(@Param("id") String id,@Param("hrpKey") String hrpKey,@Param("hrpId") String hrpId);
    Double getSumSkuQty(@Param("startDate") String startDate, @Param("endDate") String endDate);

    Double getSumAmount(@Param("startDate") String startDate, @Param("endDate") String endDate);


    //高值入账  page
    IPage<?> billInPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper<BillItem> wrapper, @Param("params") Map<String, Object> params);

    //高值入账  list
    List<BillItem> billInList(@Param(Constants.WRAPPER) QueryWrapper<BillItem> wrapper, @Param("params") Map<String, Object> params);
}
